//
//  HPNetworkEngine.h
//  Network
//
//  Created by phq on 2019/7/4.
//  Copyright © 2019 phq. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HPNConfig.h"

#define NetEngineInstance [HPNetworkEngine shareInstance]
@interface HPNetworkEngine : NSObject


/**
 获取网络请求单列

 @return 返回‘网络请求单列’
 */
+ (nonnull HPNetworkEngine *)shareInstance;


/**
 通过配置这个对象的参考来更改请求属性
 */
@property (atomic, strong) HPNConfig * _Nullable netConfig;

/**
 设置请求头

 @param value 请求头的value
 @param key 请求头的f值对应的key
 */
- (void)setHttpHeaderValue:(NSString *_Nullable)value httpHeaderField:(NSString *_Nonnull)key;


/**
 网络状态

 @return -1:未知状态；0:无联网状态；1:WWAN状态；2:WiFi状态；
 */
- (NSInteger)networkStatus;
- (BOOL)isReachable;

/**
 基于AFN联网http/https请求
 
 @param path 请求链接
 @param parameters 参数
 @param success 请求成功回调
 @param failure 请求失败回调
 */
- (void)httpsRequestPath:(NSString *_Nonnull)path
              parameters:(id _Nullable)parameters
                 success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
                 failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

@end
